package com.zhuxin.conf;

import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import com.soecode.wxtools.api.WxService;
import com.zhuxin.events.AdminMsgHandler;
import com.zhuxin.events.EventHandle;
import com.zhuxin.events.SalerMsgHandler;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class AppConfiguration {
	
	@Bean
    public ServletRegistrationBean druidServlet(String dynamicConfiguration) {
        return new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
    }
    @Bean
    public FilterRegistrationBean filterRegistrationBean() {
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
        filterRegistrationBean.setFilter(new WebStatFilter());
        filterRegistrationBean.addUrlPatterns("/*");
        filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");
        return filterRegistrationBean;
    }
    @Bean
    public WxService wxService() {
        return new WxService();
    }

    @Bean
    public SalerMsgHandler salerMsgHandler(){return new SalerMsgHandler();}


    @Bean
    public EventHandle eventHandle(){return new EventHandle();}

    @Bean
    public AdminMsgHandler adminHandle(){return new AdminMsgHandler();}
}
